#include <bits/stdc++.h>
using namespace std;
#include <vector>
int main()
{
    int n;
    cin >> n;
    vector<int> arr(100);
    while (n != 1)
    {
        if (n % 2 == 0)
        {
            arr.push_back(n);
            n /= 2;
        }
        else if (n % 2 == 1)
        {

            arr.push_back(n);
            n = n * 3 + 1;
        }
    }
    cout<<1<<" ";
    vector<int>::reverse_iterator it = arr.rbegin();
    while(it != arr.rend()){
        if(*it == 0)return 0;
        cout<<*it<<" ";
        it++;
    }

    return 0;
}